home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
cat3
/
GetSelect.3
< prev
next >
Wrap
Text File
|
1994-09-20
|
4KB
|
133 lines
Tk_GetSelection(3) Tk Library Procedures
_________________________________________________________________
NAME
Tk_GetSelection - retrieve the contents of the selection
SYNOPSIS
#include <tk.h>
int
Tk_GetSelection(_i_n_t_e_r_p, _t_k_w_i_n, _t_a_r_g_e_t, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
ARGUMENTS
Tcl_Interp *_i_n_t_e_r_p (in) Interpreter to use
for reporting errors.
Tk_Window _t_k_w_i_n (in) Window on whose
behalf to retrieve
the selection (deter-
mines display from
which to retrieve).
Atom _t_a_r_g_e_t (in) Form in which to
retrieve selection.
Tk_GetSelProc *_p_r_o_c (in) Procedure to invoke
to process pieces of
the selection as they
are retrieved.
ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word
value to pass to
_p_r_o_c.
_________________________________________________________________
DESCRIPTION
Tk_GetSelection retrieves the selection in the format speci-
fied by _t_a_r_g_e_t. The selection may actually be retrieved in
several pieces; as each piece is retrieved, _p_r_o_c is called
to process the piece. _P_r_o_c should have arguments and result
that match the type Tk_GetSelProc:
typedef int Tk_GetSelProc(
ClientData _c_l_i_e_n_t_D_a_t_a,
Tcl_Interp *_i_n_t_e_r_p,
char *_p_o_r_t_i_o_n);
The _c_l_i_e_n_t_D_a_t_a and _i_n_t_e_r_p parameters to _p_r_o_c will be copies
of the corresponding arguments to Tk_GetSelection. _P_o_r_t_i_o_n
will be a pointer to a string containing part or all of the
selection. For large selections, _p_r_o_c will be called
several times with sucessive portions of the selection. The
X Inter-Client Communication Conventions Manual allows the
selection to be returned in formats other than strings, e.g.
Tk 1
Tk_GetSelection(3) Tk Library Procedures
as an array of atoms or integers. If this happens, Tk con-
verts the selection back into a string before calling _p_r_o_c.
If the selection is returned as an array of atoms, Tk con-
verts it to a string containing the atom names separated by
white space. For any other format besides string, Tk con-
verts the selection to a string containing hexadecimal
values separated by white space.
Tk_GetSelection returns to its caller when the selection has
been completely retrieved and processed by _p_r_o_c, or when a
fatal error has occurred (e.g. the selection owner didn't
respond promptly). Tk_GetSelection normally returns TCL_OK;
if an error occurs, it returns TCL_ERROR and leaves an error
message in _i_n_t_e_r_p->_r_e_s_u_l_t. _P_r_o_c should also return either
TCL_OK or TCL_ERROR. If _p_r_o_c encounters an error in dealing
with the selection, it should leave an error message in
_i_n_t_e_r_p->_r_e_s_u_l_t and return TCL_ERROR; this will abort the
selection retrieval.
KEYWORDS
format, get, selection retrieval
Tk 2